
<!--佣金说明-->
<template>
  <div class="bg">

    <div class="content bg2">

      <div class="title">
        <text class="font34 text2">{{T('佣金说明')}}</text>
      </div>

      <div class="text">

        <div v-if="profitLayer">
          <text class="font30 text2">{{T('盈利分成')}}</text>

          <div class="height30"></div>
          <div v-for="(item, index) in profitLayer.range" v-bind:key="index">
            <div class="row acenter" >
              <text class="font28 text3 all">{{T('盈利>&{1}%的部分').replace("&{1}", item.lowerLimit)}}</text>
              <text class="font28 text2">{{T('分成&{1}%').replace("&{1}", item.proportion)}}</text>
            </div>
          </div>

          <div class="line line1"></div>
          <div class="row acenter">
            <text class="font28 text3 all">{{T('分成上限')}}</text>       
            <text class="font28 text2">{{profitLayer.maxLimit + ' VTN'}}</text>
          </div>

          <div class="height30"></div>
          <div class="row acenter">
            <text class="font28 text3 all">{{T('最小可用保证金')}}</text>
            <text class="font28 text2">{{profitLayer.minimumAvailableMargin + ' VTN'}}</text>
          </div>
        </div>
        
        <div v-if="riskIndemnityComment">
          <div class="height80"></div>
          <text class="font30 text2">{{T('亏损赔付')}}</text>

          <div class="height30"></div>
          <div v-for="(item, index) in riskIndemnityComment.range" v-bind:key="index">
            <div class="row acenter" >
              <text class="font28 text3 all">{{T('亏损>&{1}%的部分').replace("&{1}", item.lowerLimit)}}</text>
              <text class="font28 text2">{{T('赔付&{1}%').replace("&{1}", item.commentProportion)}}</text>
            </div>
          </div>

          <div v-if="endTime">
            <div class="line line1"></div>
            <div class="row acenter">
              <text class="font28 text3 all">{{T('赔付承诺生效时间')}}</text>        
              <text class="font28 text2">{{endTime}}</text>
            </div>
          </div>
        </div>
      </div>
      
      <div class="ok-but" @click="okCLick">
        <text class="font34 main-t1">{{T('知道了')}}</text>
      </div>
    </div>
  </div>
</template>

<style src="@/_css/style.css" ></style>
<style scoped>
.bg {
  justify-content: center;
  align-items: center;
  flex: 1;
  background-color:rgba(0,0,0,0.6);
}
.line {
  height: 1px;
  margin-top: 30px;
  margin-bottom: 30px;
}
.content{
  width:600px;
  border-radius:24px;
}
.title {
  align-items: center;
  margin-top: 50px;
  margin-bottom: 50px;
}
.text{
  padding-left: 40px;
  padding-right: 40px;
}
.ok-but {
  justify-content: center;
  align-items: center;
  flex: 1;
  height: 120px;
}

/***************** 间距*/
.height80{
  height: 80px;
}
</style>

<script>

import jmath from "@/_js/math";
import jnavigator from "@/_js/navigator";
import jtime from "@/_js/time";

import I18N from "@/_i18n/i18n";
var T = I18N.t;

export default {
  
  data() {
    return {
      T:T,

      riskIndemnityComment:undefined,
      profitLayer:undefined,
      endTime:undefined,
    };
  },

  created(){
    var param = weex.config;
    this.wallet = param.wallet;

    this.riskIndemnityComment = param.riskIndemnityComment;
    this.profitLayer = param.profitLayer;
    var startTime = param.startTime;
    if (this.riskIndemnityComment) {
      this.endTime = this.getEndTime(startTime, this.riskIndemnityComment.effectTime);
    }
  },

  methods: {

    //获取结束时间
    getEndTime(startTime, effectTime) {
      var delayed = jmath.cheng(effectTime, '86400000', 0, 1);
      startTime = startTime + Number(delayed);
      var time = jtime.getTime(startTime, 'y/M/d H:m');
      return time;
    },

    /**************** 按钮点击*/
    //知道了
    okCLick(){
      jnavigator.dismiss();
    }
  }
};

</script>
